define(
	[
		'require',
		'./detail_nodedetail_alarms_ctrl'
	],
	function(require){
		var Controller = require('./detail_nodedetail_alarms_ctrl').extend({

			businessIdChange: Ember.observer("business.id", function(){
				this.set('keyWord', '');
			}),
			
			requireAlerts: function() {
				var ctrl = this,
					tradeId = this.get("model.id");

				var startDate = this.get("startDate"),
					endDate = this.get("endDate");

				var params = {
					id: tradeId,
					type:'resource',
					rows: 10,
					keyWord: this.get("keyWord"),
					startDate: +startDate,
					endDate: +endDate
				};
				//开发调试模式参数
				if( isLocalDebugModel ){
					params = undefined;
				}

				return this.store.ajax("GET", "alarms/latest", params)
				.then(function(response){
					var alerts = response.alerts;
					ctrl.set("alerts", alerts);
					return response;
				});
			}
		});

		APM.BusinessDetailTradeAlarmsController = Controller;

		return Controller;
	}
);	